home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AppsToGo / DTS.Draw / WindowPalette.c < prev   
Encoding:
C/C++ Source or Header  |  1994-09-22  |  7.0 KB  |  306 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        WindowPalette.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1990-1993 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19.  
  20.  
  21. /*****************************************************************************/
  22.  
  23.  
  24.  
  25. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  26. #include "App.protos.h"        /* Get the prototypes for application.            */
  27.  
  28. #ifndef __ERRORS__
  29. #include <Errors.h>
  30. #endif
  31.  
  32. #ifndef __UTILITIES__
  33. #include "Utilities.h"
  34. #endif
  35.  
  36.  
  37.  
  38. /*****************************************************************************/
  39.  
  40.  
  41.  
  42. extern short        gPrintPage;                /* Non-zero means we are printing. */
  43.                                             /* DTS.Lib..framework global. */
  44.  
  45. extern RgnHandle    gCursorRgn;                /* We handle cursors here, so we need */
  46. extern CursPtr        gCursorPtr;                /* to know about these things. */
  47.                                             /* Above are DTS.Lib..framework globals. */
  48.  
  49.  
  50.  
  51. /*****************************************************************************/
  52. /*****************************************************************************/
  53.  
  54. #ifdef applec
  55. #pragma segment DTSDrawSeg2
  56. #endif
  57.  
  58. /*****************************************************************************/
  59. /*****************************************************************************/
  60.  
  61.  
  62.  
  63. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  64. /* See CalcFrameRgn() for info. */
  65.  
  66. void    PaletteCalcFrameRgn(FileRecHndl frHndl, WindowPtr window, RgnHandle rgn)
  67. {
  68. #ifndef __MWERKS__
  69. #pragma unused (frHndl, window, rgn)
  70. #endif
  71. }
  72.  
  73.  
  74.  
  75. /*****************************************************************************/
  76.  
  77.  
  78.  
  79. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  80. /* See ContentClick() for info. */
  81.  
  82. void    PaletteContentClick(WindowPtr window, EventRecord *event, Boolean firstClick)
  83. {
  84. #ifndef __MWERKS__
  85. #pragma unused (firstClick)
  86. #endif
  87.  
  88.     ControlHandle    ctl;
  89.     short            action, cnum;
  90.  
  91.     cnum = IsCtlEvent(window, event, &ctl, &action);
  92.     return;
  93. }
  94.  
  95.  
  96.  
  97. /*****************************************************************************/
  98.  
  99.  
  100.  
  101. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  102. /* See ContentKey() for info. */
  103.  
  104. Boolean    PaletteContentKey(WindowPtr window, EventRecord *event, Boolean *passThrough)
  105. {
  106. #ifndef __MWERKS__
  107. #pragma unused (passThrough)
  108. #endif
  109.  
  110.     short    cnum;
  111.  
  112.     cnum = IsCtlEvent(window, event, nil, nil);
  113.     if (!cnum) {
  114.         *passThrough = true;
  115.         return(false);
  116.     }
  117.  
  118.     return(true);
  119. }
  120.  
  121.  
  122.  
  123. /*****************************************************************************/
  124.  
  125.  
  126.  
  127. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  128. /* See DrawFrame() for info. */
  129.  
  130. void    PaletteDrawFrame(FileRecHndl frHndl, WindowPtr window, Boolean activate)
  131. {
  132.     MoveTo(0, (*frHndl)->fileState.topSidebar - 1);
  133.     LineTo((*frHndl)->fileState.leftSidebar - 1 - 16384, (*frHndl)->fileState.topSidebar - 1);
  134.     LineTo((*frHndl)->fileState.leftSidebar - 1 - 16384, 16383);
  135.  
  136.     BeginFrame(window);
  137.     DoDrawControls(window, activate);
  138.     EndFrame(window);
  139. }
  140.  
  141.  
  142.  
  143. /*****************************************************************************/
  144.  
  145.  
  146.  
  147. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  148. /* See FreeDocument() for info. */
  149.  
  150. OSErr    PaletteFreeDocument(FileRecHndl frHndl)
  151. {
  152.     return(DefaultFreeDocument(frHndl));
  153. }
  154.  
  155.  
  156.  
  157. /*****************************************************************************/
  158.  
  159.  
  160.  
  161. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  162. /* See FreeWindow() for info. */
  163.  
  164. OSErr    PaletteFreeWindow(FileRecHndl frHndl, WindowPtr window)
  165. {
  166. #ifndef __MWERKS__
  167. #pragma unused (frHndl, window)
  168. #endif
  169.  
  170.     return(noErr);
  171. }
  172.  
  173.  
  174.  
  175. /*****************************************************************************/
  176.  
  177.  
  178.  
  179. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  180. /* See ImageDocument() for info. */
  181.  
  182. OSErr    PaletteImageDocument(FileRecHndl frHndl)
  183. {
  184. #ifndef __MWERKS__
  185. #pragma unused (frHndl)
  186. #endif
  187.  
  188.     WindowPtr    curPort;
  189.  
  190.     GetPort(&curPort);
  191.     if (!gPrintPage) {                                    /* If not printing... */
  192.         DoDrawControls(curPort, false);                    /* Draw the content controls. */
  193.     }
  194.  
  195.     return(noErr);
  196. }
  197.  
  198.  
  199.  
  200. /*****************************************************************************/
  201.  
  202.  
  203.  
  204. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  205. /* See InitContent() for info. */
  206.  
  207. OSErr    PaletteInitContent(FileRecHndl frHndl, WindowPtr window)
  208. {
  209.     OSErr    err;
  210.  
  211.     err = AddControlSet(window, (*frHndl)->fileState.sfType, kwStandardVis, 0, 0, nil);
  212.     return(err);
  213. }
  214.  
  215.  
  216.  
  217. /*****************************************************************************/
  218.  
  219.  
  220.  
  221. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  222. /* See ResizeContent() for info. */
  223.  
  224. void    PaletteResizeContent(WindowPtr window, short oldh, short oldv)
  225. {
  226. #ifndef __MWERKS__
  227. #pragma unused (window, oldh, oldv)
  228. #endif
  229.  
  230.     /* See DTS.Chat for a sample usage of this function. */
  231. }
  232.  
  233.  
  234.  
  235. /*****************************************************************************/
  236.  
  237.  
  238.  
  239. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  240. /* See ScrollFrame() for info. */
  241.  
  242. void    PaletteScrollFrame(FileRecHndl frHndl, WindowPtr window, long dh, long dv)
  243. {
  244. #ifndef __MWERKS__
  245. #pragma unused (frHndl, window, dh, dv)
  246. #endif
  247. }
  248.  
  249.  
  250.  
  251. /*****************************************************************************/
  252.  
  253.  
  254.  
  255. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  256. /* See UndoFixup() for info. */
  257.  
  258. void    PaletteUndoFixup(FileRecHndl frHndl, Point contOrg, Boolean afterUndo)
  259. {
  260. #ifndef __MWERKS__
  261. #pragma unused (frHndl, contOrg, afterUndo)
  262. #endif
  263.  
  264.     /* See DTS.Draw for an example of what you might do here. */
  265. }
  266.  
  267.  
  268.  
  269. /*****************************************************************************/
  270.  
  271.  
  272.  
  273. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  274. /* See WindowCursor() for info. */
  275.  
  276. Boolean    PaletteWindowCursor(FileRecHndl frHndl, WindowPtr window, Point globalPt)
  277. {
  278. #ifndef __MWERKS__
  279. #pragma unused (frHndl, window, globalPt)
  280. #endif
  281.  
  282.     /* For examples of applications that have non-arrow cursor regions,
  283.     ** see DTS.Chat and DTS.Draw. */
  284.  
  285.     DoSetCursor(&qd.arrow);
  286.     return(true);
  287. }
  288.  
  289.  
  290.  
  291. /*****************************************************************************/
  292.  
  293.  
  294.  
  295. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  296. /* See WindowGoneFixup() for info. */
  297.  
  298. void    PaletteWindowGoneFixup(WindowPtr window)
  299. {
  300. #ifndef __MWERKS__
  301. #pragma unused (window)
  302. #endif
  303. }
  304.  
  305.  
  306.